/*
 * Copyright 2016 Wealth Inc. All rights reserved.
 */
 package com.wealth.platform.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.wealth.platform.entity.SldConfig;
import com.wealth.platform.repository.SldConfigDao;
import com.wealth.platform.service.ISldConfigService;
import com.wealth.platform.vo.SldConfigVO;

import iaas.service.impl.BaseServiceImpl;

/**
 * @author chan
 */
 @Component
public class SldConfigServiceImpl extends BaseServiceImpl<SldConfig> implements ISldConfigService{

	@Autowired
	private SldConfigDao sldConfigDao;

	@Override
	public SldConfig getSldConfigByCorpIdAndType(Long corpid,Integer type) throws Exception {
		return sldConfigDao.findByCorpIdAndType(corpid,type);
	}

	@Override
	public List<SldConfigVO> getSldConfigVoList() throws Exception {
		List<SldConfig> sldConfigList = sldConfigDao.findAll();
		List<SldConfigVO> volist = new ArrayList<SldConfigVO>();
		for (SldConfig sldConfig : sldConfigList) {
			SldConfigVO vo = new SldConfigVO();
			vo.setCorpid(sldConfig.getCorp().getId());
			vo.setDomain(sldConfig.getDomain());
			vo.setType(sldConfig.getType());
			volist.add(vo);
		}
		return volist;
	}

	@Override
	public List<SldConfig> getSldConfidAndCorpIdNotNoe() throws Exception {
		return sldConfigDao.findByCorpIdNot(1L);
	}
}


